﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace BookSystem
{
    public partial class LookForPswdForm : Form
    {
        public LookForPswdForm()
        {
            InitializeComponent();
        }

        private void LookForPswdForm_Load(object sender, EventArgs e)
        {

        }

        private void LookForPswdForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            Application.Exit();
        }

        private void lab_Login_Click(object sender, EventArgs e)
        {
            LoginMainForm LoginMainForm = new LoginMainForm();
            LoginMainForm.Show();
            this.Hide();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string number = this.box_number.Text;
            string name = this.box_name.Text;
            string pswdone = this.box_pswdone.Text;
            string pswdtwo = this.box_pswdtwo.Text;

            if (pswdone == pswdtwo)
            {
                string sql = string.Format("update T_Users set pswd='{0}' where Id={1} and Name='{2}'",
                    pswdone, number, name);
                if (DBHepler.SqlCommand(sql) > 0)
                {
                    MessageBox.Show("密码修改成功啦", "修改提示：",
                    MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("您两次输的密码不同呢/", "密码提示：",
                    MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
            }

        }
    }
}
